#version 440 core

#define LOC_SIZE 64

#define GRID_SIZE_X 64
#define GRID_SIZE_Y 64

uniform uint numActiveNodes;

layout(local_size_x=LOC_SIZE) in;

layout(binding=2, r32f) uniform writeonly image2D levelSetImageDst;

layout(std430, binding=0) buffer activeNodesBuffer
{
	ivec2 activeNodes[];
};

layout(std430, binding=2) buffer activeNodeLevelSetBuffer
{
	float activeNodeLevelSetValues[];
};

void main(void)
{
	uint gid = gl_GlobalInvocationID.x;
	if (gid < numActiveNodes)
	{
		imageStore(levelSetImageDst, activeNodes[gid], vec4(activeNodeLevelSetValues[gid],0.0,0.0,1.0));
	}
}